<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="css/base.css" />
<link rel="stylesheet" href="css/info-reg.css" />
<script type="text/javascript" src="js/WdatePicker.js"></script>
<title>移动办公自动化系统</title>
<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.js"></script>
<script type="text/javascript">
	$(function(){
		$.ajax({
			type:"post",
			url:"MsgManager.action?method=ajaxdept",
			success:function(page){
				var str="";
				for(var i=0;i<page.length;i++){
					str+="<option value='"+page[i].deptId+"'>";
					str+=page[i].deptName;
					str+="</option>";
				}
				$("#deptname").html(str);
				show();
			}
		});
		function show(){
			var id='${requestScope.mView.userDeptId }';
			var work='${requestScope.mView.empWork }';
			$("#deptname").find("option[value="+id+"]").attr("selected",true);
			$("#work").find("option[value="+work+"]").attr("selected",true);
		}
	});
	function checkImg(node){
		var imgURL="";
	        try{     
	            var file = null;  
	            if(node.files && node.files[0] ){  
	                file = node.files[0];   
	            }else if(node.files && node.files.item(0)) {                                  
	                file = node.files.item(0);     
	            }     
	            //Firefox 因安全性问题已无法直接通过input[file].value 获取完整的文件路径  
	            try{  
	                //Firefox7.0   
	                imgURL =  file.getAsDataURL();    
	                //alert("//Firefox7.0"+imgURL);                           
	            }catch(e){  
	                //Firefox8.0以上                                
	                imgURL = window.URL.createObjectURL(file);  
	                //alert("//Firefox8.0以上"+imgURL);  
	            }  
	         }catch(e){      //这里不知道怎么处理了，如果是遨游的话会报这个异常                   
	            //支持html5的浏览器,比如高版本的firefox、chrome、ie10及以上  
	            if (node.files && node.files[0]) {                            
	                var reader = new FileReader();   
	                reader.onload = function (e) {                                        
	                    imgURL = e.target.result;    
	                };  
	                reader.readAsDataURL(node.files[0]);   
	            }    
	         }
		$(".img").css("background-image","url("+imgURL+")");	
	}
</script>
<style>
	.img{background-size:100% 100%;position:absolute;width:263px;height:355px;top:30px;right:250px;
	background-image:url(${pageContext.request.contextPath }/file/file_Img/${requestScope.mView.userImg });}
</style>
</head>

<body>
<div class="title"><h2>&nbsp;人事信息</h2></div>
<div class="main">
<form name="form1" method="post" action="${pageContext.request.contextPath}/MsgManager.action?method=update" enctype="multipart/form-data">
	<input type="hidden" name="currPage" value="${requestScope.currPage }"/>
	<table>
	<tr><td>
    <p class="long-input ue-clear">
    	<label>档案编号：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="recordid" value="${requestScope.mView.recordId }" readonly="readonly" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>员工编号：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="userid" value="${requestScope.mView.userId }" readonly="readonly" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>员工姓名：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="name" value="${requestScope.mView.userName }" readonly="readonly" />
    </p></td></tr>
     <tr><td>
    <p class="long-input ue-clear">
    	<label>性别：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="sex" value="${requestScope.mView.userSex }" readonly="readonly" />
    </p></td></tr>
     <tr><td>
    <p class="long-input ue-clear">
    	<label>身份证号：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="idcard" value="${requestScope.mView.userIdcard }" readonly="readonly" />
    </p></td></tr>
     <tr><td>
    <p class="long-input ue-clear">
    	<label>银行卡号：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="bankid" value="${requestScope.mView.userBankId }" readonly="readonly" />
    </p></td></tr>
     <tr><td>
    <p class="long-input ue-clear">
    	<label>电话：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="phone" value="${requestScope.mView.userPhone }" />
    </p></td></tr>
   <tr><td>
    <p class="long-input ue-clear">
    	<label>备用电话：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="backphone" value="${requestScope.mView.userBackupPhone }" />
    </p></td></tr>
   <tr><td>
    <p class="long-input ue-clear">
    	<label>电子邮箱：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="email" value="${requestScope.mView.userEmail }" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>家庭地址：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="address" value="${requestScope.mView.userAddress }" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>婚姻状态：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="marray" value="${requestScope.mView.marriageStatus}" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>入职日期：</label></p></td>
        <td><p class="short-input ue-clear"><input type="text" name="datatime" value="${requestScope.mView.enterDate}" readonly="readonly" />
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>所属部门：</label></p></td>
        <td><p class="short-input ue-clear"><select id="deptname" name="deptid">
        </select>
    </p></td></tr>
    <tr><td>
    <p class="long-input ue-clear">
    	<label>员工职位：</label></p></td>
        <td><p class="short-input ue-clear"><select id="work" name="work">
        <option value="经理">经理</option>
        <option value="员工">员工</option>
        </select></p></td></tr>
     <tr><td>
        <div class="img"><input style="opacity:0;width:263px;height:355px;" type="file" id="imgg" name="img" onchange="checkImg(this);"/></div>
    </td></tr>    
	</table>
	    <div class="btn ue-clear">
	<a href="javascript:document.form1.submit();" class="confirm">确定修改</a>
    <a href="javascript:history.back();" class="clear">返回</a>
	</div>
</form>
</div>
</body>
</html>


